Highlighting fluid properties menu end sub user controls -> teeview_menu. Menutablename as string = "" private menuid as int32 = 0 private menuparentid as 0 private root as treenode dim mtable as datatable = new datatable() me.filltree() me.treeviewmenu.nodes.clear() end sub page_load(byval sender as object, byval e as system.eventargs)
Highlighting fluid properties menu end sub user controls -> teeview_menu. Menutablename as string = "" private menuid as int32 = 0 private menuparentid as 0 private root as treenode dim mtable as datatable = new datatable() me.filltree() me.treeviewmenu.nodes.clear() end sub page_load(byval sender as object, byval e as system.eventargs)
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online from Scribd
Highlighting fluid properties menu end sub user controls -> teeview_menu. Menutablename as string = "" private menuid as int32 = 0 private menuparentid as 0 private root as treenode dim mtable as datatable = new datatable() me.filltree() me.treeviewmenu.nodes.clear() end sub page_load(byval sender as object, byval e as system.eventargs)
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online from Scribd
inherits system.web.ui.usercontrol private menutablename as string = "" private menuid as int32 = 0 private menuparentid as int32 = 0 private root as treenode dim mtable as datatable = new datatable()
public property menutable() as string
get return menutablename end get set(byval value as string) if value <> nothing then menutablename = value end if end set end property
public property menunumber() as string
get return menuid end get set(byval value as string) if value <> nothing then menuid = value end if end set end property
public property menuparentnumber() as string
get return menuparentid end get set(byval value as string) if value <> nothing then menuparentid = value end if end set end property protected sub page_load(byval sender as object, byval e as system.eventargs) handles me.load me.createdatatable() me.filltree()
dim treenode as new system.web.ui.webcontrols.treenode
for each treenode in me.treeviewmenu.nodes() if treenode.value = me.menunumber then treenode.selected = true else treenode.selected = false end if next me.treeviewmenu.expandall() end sub
private sub filltree()
me.treeviewmenu.nodes.clear()
for i as integer = 0 to mtable.rows.count - 1
dim root as treenode root = new treenode() if mtable.rows(i).item(2) = 0 then root.text = mtable.rows(i).item(1) root.value = mtable.rows(i).item(0) root.navigateurl = mtable.rows(i).item(3) root = create_child(root, mtable.rows(i).item(0)) me.treeviewmenu.nodes.add(root) end if next end sub
private function create_child(byval parent as treenode, byval menuno as
integer) as treenode dim childnode as treenode dim rowcount as integer = 0 for k as integer = 0 to mtable.rows.count - 1 if mtable.rows(k).item(2) = menuno then rowcount = rowcount + 1 end if next if rowcount = 0 then return parent else for k as integer = 0 to mtable.rows.count - 1 if mtable.rows(k).item(2) = menuno then childnode = new treenode() childnode.text = mtable.rows(k).item(1) childnode.value = mtable.rows(k).item(0) childnode.navigateurl = mtable.rows(k).item(3) parent.childnodes.add(childnode) if menuid = mtable.rows(k).item(0) then childnode.selected = true end if create_child(childnode, mtable.rows(k).item(0)) end if next return parent end if end function
protected sub treeviewmenu_prerender(byval sender as object, byval e as
system.eventargs) handles treeviewmenu.prerender 'me.treeviewmenu.collapseall() end sub
function doexpand(byval menuid as integer, byval nodecollection as
system.web.ui.webcontrols.treenodecollection) as system.web.ui.webcontrols.treenodecollection dim treenode as new system.web.ui.webcontrols.treenode for each treenode in nodecollection if treenode.value = menuid then treenode.expand() return treenode.childnodes end if next end function
private sub createdatatable()
if session("menudb") is nothing then mtable.columns.add(new datacolumn("menuid", gettype(decimal))) mtable.columns.add(new datacolumn("text", gettype(string))) mtable.columns.add(new datacolumn("parentid", gettype(decimal))) mtable.columns.add(new datacolumn("navigateurl", gettype(string))) session("menudb") = mtable else mtable = ctype(session("menudb"), datatable) end if mtable.clear()